package com.cq.hd.common.enums.biz;

import lombok.Getter;

/**
 * @description: 活动状态（1-未发布，2-未开始，3-进行中，4-已结束）
 * @author: mYunYu
 * @date: 2021/8/23 14:28
 * @version: v1.0
 */
public enum ActiveStateEnum {

    NO_RELEASE(1, "未发布"),
    NO_START(2, "未开始"),
    IN_PROGRESS(3, "进行中"),
    ENDED(4, "已结束"),
    ;

    @Getter
    private final Integer value;

    @Getter
    private final String name;

    ActiveStateEnum(Integer value, String name) {
        this.value = value;
        this.name = name;
    }

    public static ActiveStateEnum typeOf(Integer value) {
        ActiveStateEnum[] values = ActiveStateEnum.values();
        for (ActiveStateEnum v : values) {
            if (v.value.equals(value)) {
                return v;
            }
        }
        return null;
    }

    public static ActiveStateEnum typeOf(String name) {
        ActiveStateEnum[] values = ActiveStateEnum.values();
        for (ActiveStateEnum v : values) {
            if (v.name.equals(name)) {
                return v;
            }
        }
        return null;
    }

}
